home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Herra / TIMWIN.ZIP / LABEL2.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-22  |  2KB  |  82 lines

  1. ;label   --   
  2. ;expects:    image (cermet or chromo) in a
  3. ;
  4. #include timdefs.h
  5. parms
  6.   int windis
  7. endparms
  8. int aant
  9. int opp
  10. int num = 2
  11. int maxn
  12. int maxd
  13. float perilen
  14. float shape
  15. int borderpix
  16. int dr_old
  17. int err
  18.  
  19. cls
  20. dr_old = set 4 128        ;drawing value
  21. dest p
  22. show p
  23. copy a
  24. *windispl i windis
  25. bord 0
  26. aant = label -128
  27. *windispl h (windis+NO_DITHER+WINLUT4)
  28. if aant < 5
  29.   print "Wrong image loaded (must be CERMET or CHROMO)"
  30.   stop
  31. endif
  32. mark 1 0          ;remove obj 1 and initialise mark pointer
  33. dest q
  34. era
  35. ;err = chk lut 2 4
  36. /selut 4          ;select LUT 4
  37. num = 2
  38. curlock s q 1
  39. curlock r q 1
  40. curlock a q 1       ;non-display images have no default lock
  41. err = chk curlock h q 1    ;'h' is not always present
  42.  
  43. repeat        ;until
  44.     dest q
  45.     maxn = mark p num 248 /   ;0f8h
  46.     if maxn < 20
  47.       era qc
  48.     else
  49.       dest r
  50.       and ac qc
  51.       dest q
  52.       borderpix = maxn - (lcon qc 8)
  53.       bsw qc 8 2 
  54.       bcop qc 2 3
  55. ;no non-square pixel correction, image was recorded using SqPix FrameGrabber
  56.       perilen = fcont q 3 1   
  57.       maxd = maxl 3 1 /     ;perform calculation in integer (/)
  58.         ;for accurate measurement of shape we have to correct for 
  59.         ;the effect that the object's border is in the middle of the contour:
  60.         ;we have to substract half of the contour pixels from the area
  61.       shape = (perilen**2)/(12.56637*(maxn-(borderpix/2)))
  62.       dest s
  63.       copy qc sc
  64.       era qc
  65.       print "Obj.",num, @12, "area:",maxn, @24 "perim:", perilen,@40,"diam:",maxd, @50 "shape:", shape
  66.       text s 128 "%d", num
  67.       text r 128 "%d", num
  68.     endif
  69. ;    num += 1
  70.      *windispl hc (windis+NO_DITHER)
  71. until ++num > aant
  72.  
  73. dest s
  74. *windispl h (windis+NO_DITHER)
  75. dest r
  76. *windispl i windis
  77. set 4 dr_old
  78. stop
  79.  
  80.  
  81. 
  82.